package cn.genmer.test.security.service.impl;

import cn.genmer.test.security.mapper.UserMapper;
import cn.genmer.test.security.model.User;
import cn.genmer.test.security.model.dto.ModifiedSource;
import cn.genmer.test.security.recordlog.annotation.ModificationLog;
import cn.genmer.test.security.recordlog.annotation.PerformanceLog;
import cn.genmer.test.security.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service(value = UserService.BEAN_ID)
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    @ModificationLog(primaryKey = "#user.id", poClazz = User.class, source = "#source.source")
    @PerformanceLog
    public void updateUserInfo(User user, ModifiedSource source) {
        userMapper.updateById(user);
        System.out.println("更新！");
    }
}
